package cn.DesignModel.decorator;

/**
 * @author: lizemin
 * @version: 1.0
 */
public class Demo {
    //这是一个main方法,是程序的入口
    public static void main(String[] args) {
        Beverage beverage = new Espresso();
        System.out.println("浓缩咖啡：" + beverage.getDescription() + "," + beverage.cost());

        System.out.println("------------浓缩咖啡被装饰者装饰后-----------------------");
        // 抽象装饰者的 "类型匹配" 如下 —— 可以用同一个实例对象接收装饰对象，以达到类行为扩展的目的。
        beverage = new Mocha(beverage);
        beverage = new Mocha(beverage);
        System.out.println("浓缩咖啡+2份摩卡：" + beverage.getDescription() + "," + beverage.cost());


    }
}
